package com.xxxx.web.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxxx.web.dto.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 商品分类表表
 */
@Data
@TableName("`CargoType`")
public class CargoType extends BaseEntity {


    /**
     * 名称
     */
    @JsonProperty("Name")
    @TableField(value = "Name", updateStrategy = FieldStrategy.IGNORED)
    private String Name;

    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    @TableField(value = "WarehouseId", updateStrategy = FieldStrategy.IGNORED)
    private Integer WarehouseId;

    /**
     * 把商品分类表实体转换成商品分类表传输模型
     */
    public CargoTypeDto MapToDto() throws InvocationTargetException, IllegalAccessException {
        CargoTypeDto CargoTypeDto = new CargoTypeDto();

        BeanUtils.copyProperties(CargoTypeDto, this);

        return CargoTypeDto;
    }

}
